 <script>  
        
function togetherManager() {
    this.versionType = 3; // 客户端版本4.3.0及以下
    this.initFlag = true;
    this.shareBegin = false;
  //  alert('typeof');
  //  this.bgmEl = document.getElementById('bgm');
     // alert(this.bgmEl);
    this.shareConfig = {
            url: share.url,
            title:share.title,
            activityId:'together2015',
            summary:share.desc,
            shareImg: share.img
        };
      //  alert('ddddddddddd');
  this.init();
}

togetherManager.prototype.init = function () {
    var self = this;
    this.ua = window.navigator.userAgent;
    this.isWeixin = (/MicroMessenger/ig).test(this.ua);    
    this.isYiXin = (/YiXin/ig).test(this.ua);
    this.isQQ = (/QQ/ig).test(this.ua);
    this.isQQBrowser = (/QQBrowser/ig).test(this.ua);
    this.isWeibo = (/weibo/ig).test(this.ua); 
        window.pris = {};
        window.active = {}; 
        pris.setclientinfo=function(data){ // 客户端回调
         
            if (data == null) return;
            if (typeof data == 'string') { 
                data = JSON.parse(decodeURIComponent(data));
            } 
          var version=self.compareVersion(data.version, '4.7.0');
            
            if(version==-1){///提示版本过低
                home.MsgVersion();
            }
            
            
        };
        //// alert(typeof(callByApp));
    /*  callByApp('web:getclientinfo;');
      ///   alert('90');
        setTimeout(function() {
            if (self.versionType == 3) { // 客户端版本4.3.0及以下
               //  home.MsgVersion();
            }
        }, 1000); */

}
 
 
togetherManager.prototype.weiXinApi = function() {
	var self = this;
    WeixinApi.ready(function(Api) {
        // 微信分享的数据
        var wxData = {
            "appId": "", // 服务号可以填写appId
            "imgUrl" : self.shareConfig.shareImg,
            "link" : self.shareConfig.url,
            "desc" : self.shareConfig.summary,
            "title" : self.shareConfig.title
        };

        // 分享的回调
        var wxCallbacks = {
            favorite : false,
        };

        // 用户点开右上角popup菜单后，点击分享给好友，会执行下面这个代码
        Api.shareToFriend(wxData, wxCallbacks);

        // 点击分享到朋友圈，会执行下面这个代码
        Api.shareToTimeline(wxData, wxCallbacks);

        // iOS上，可以直接调用这个API进行分享，一句话搞定
        Api.generalShare(wxData,wxCallbacks);
    });
}

togetherManager.prototype.onShare = function() {
   
        var shareConfig = this.shareConfig;

        // data.data必须随便传一个值,否则安卓无法回调
        var data = "{\"activityId\":\"" + shareConfig.activityId + "\",\"moduleType\":\"['_share_weixin','_share_weixinquan','_share_yixin','_share_yixinquan','_share_tsina','_share_qzone']\",\"site\":\"网易云阅读官方网站\","
                +"\"url\":\"" + shareConfig.url + "\",\"title\":\"" + shareConfig.title + "\",\"pics\":\"" + shareConfig.shareImg + "\","
                +"\"summary\":\"" + shareConfig.summary + "\",\"shareType\":\"1\",\"data\":{\"activityId\":\"" + shareConfig.activityId + "\"}}";

        window.active.shareCompleted = function(data) {
            h.on_share('云阅读分享');
          //  alert('分享回调'); alert(data);
            var delayTime = 0;
            var ua = navigator.userAgent;
            if (~ua.indexOf('android')) { // 安卓触发分享以后立即回调不会等分享成功
                delayTime = 2000;
            } else { // TODO iphone(微信，微博分享回调条件不一致，待客户端统一后，修复)
                delayTime = 1000;
            }
            
        }
        location.href="web:getclientsharemodule;data="+encodeURIComponent(data);
   
}

/**
 * 比较两个版本号
 * 版本格式：x.x.x
 * @return -1 小于；0，等于；1，大于
 */
togetherManager.prototype.compareVersion = function(str1, str2) {
    var v1 = str1.split(".");
    var v2 = str2.split(".");
    var l1 = v1.length;
    var l2 = v2.length;
    for(var i=0; i<Math.max(l1, l2); i++) {
        var k1 = 0;
        if(i < l1) {
            k1 = parseInt(v1[i]);
        }

        var k2 = 0;
        if(i < l2) {
            k2 = parseInt(v2[i]);
        }

        if(k1 != k2) {
            return k1 > k2 ? 1 : -1;
        }
    }
    return 0;
}

 

 
var readS=new togetherManager();

sh.fenxiang=function(){
    readS.onShare(); 
};

function callByApp(url) {
   
    
    var iframe = document.createElement("iframe");
    iframe.id = 'callbyapp';
    iframe.style.border = "none";//iFrame.setAttribute("style", "display:none;");
    iframe.style.width = "0px";
    iframe.style.height = "0px";
    iframe.style.display='none';
    iframe.src = url;
    document.body.appendChild(iframe);
    window.setTimeout(function(){
        document.body.removeChild(iframe);
    },3000);

    };


</script>